package org.liu.simpleTank.resource;

import java.awt.Image;
import java.awt.image.BufferedImage;
import java.net.URL;

import javax.imageio.ImageIO;

public class BulletImage {
	private static BufferedImage bullets;
	static {
		try {
			Class c = Class.forName("org.liu.simpleTank.resource.BulletImage");
			URL bulletsUrl = c.getResource("bullet.png");
			bullets = ImageIO.read(bulletsUrl);
		} catch(Exception e) { e.printStackTrace(); }
	}
	
	private static int BULLET_SIZE = 8;
	
	public static Image getBulletImg(int dir) {
		return bullets.getSubimage(dir * BULLET_SIZE, 0, BULLET_SIZE, BULLET_SIZE);
	}
}
